//package com.ruoyi.livesass;
//
//import java.time.LocalDateTime;
//import java.time.ZoneOffset;
//import java.time.format.DateTimeFormatter;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Map;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.ApplicationArguments;
//import org.springframework.boot.ApplicationRunner;
//import org.springframework.core.annotation.Order;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.stereotype.Component;
//
//import com.alibaba.fastjson.JSONObject;
//import com.google.common.collect.Lists;
//import com.google.common.collect.Maps;
//import com.volcengine.model.beans.livesaas.Coupon;
//import com.volcengine.model.beans.livesaas.CreateActivityCouponModel;
//import com.volcengine.model.beans.livesaas.CreateCouponModel;
//import com.volcengine.model.beans.livesaas.MenuMsgNew;
//import com.volcengine.model.beans.livesaas.ProductAPIs;
//import com.volcengine.model.beans.livesaas.ProductMsgAPI;
//import com.volcengine.model.livesaas.request.CommonRequest;
//import com.volcengine.model.livesaas.request.CreateActivityCouponsRequest;
//import com.volcengine.model.livesaas.request.CreateCouponsRequest;
//import com.volcengine.model.livesaas.request.ExplainProductRequest;
//import com.volcengine.model.livesaas.request.GetCouponRequest;
//import com.volcengine.model.livesaas.request.ListCouponsRequest;
//import com.volcengine.model.livesaas.request.ListProductCardsRequest;
//import com.volcengine.model.livesaas.request.ModifyActivityMenusRequest;
//import com.volcengine.model.livesaas.request.SendActivityCouponRequest;
//import com.volcengine.model.livesaas.request.SendProductOrderMessageRequest;
//import com.volcengine.model.livesaas.request.UpdateActivityProductV2Request;
//import com.volcengine.model.livesaas.response.CommonStatusResponse;
//import com.volcengine.model.livesaas.response.CreateActivityCouponsResponse;
//import com.volcengine.model.livesaas.response.CreateCouponsResponse;
//import com.volcengine.model.livesaas.response.GetActivityProductAPIResponse;
//import com.volcengine.model.livesaas.response.GetCouponResponse;
//import com.volcengine.model.livesaas.response.ListCouponsResponse;
//import com.volcengine.model.livesaas.response.ListProductCardsResponse;
//import com.volcengine.model.livesaas.response.ModifyActivityMenusResponse;
//import com.volcengine.model.livesaas.response.SendActivityCouponResponse;
//import com.volcengine.model.livesaas.response.SendProductOrderMessageResponse;
//import com.volcengine.model.livesaas.response.SendActivityCouponResponse.SendActivityCouponResponseBody;
//import com.volcengine.service.livesaas.LivesaasService;
//import com.volcengine.service.livesaas.impl.LivesaasServiceImpl;
//
//import cn.hutool.crypto.digest.DigestUtil;
//import cn.hutool.crypto.digest.MD5;
///**
//* @ClassName: ProductVideoService 
//* @Description: TODO(商品相关接口) 
//* @author 晏大兵 
//* @date 2025年2月10日 上午11:13:06 
//*/
//@Component
//public class ProductVideoTestService implements ApplicationRunner {
//	
//	
//    @Autowired
//    public RedisTemplate redisTemplate;
//    
//    private static final long BEGIN_TIMESTAMP = 1659312000l;
//    
//	@Override
//	public void run(ApplicationArguments args) throws Exception {
//		// TODO Auto-generated method stub
//		for( int i = 0 ; i < 20 ; i++) { 
//			new Thread(new Runnable() {
//				@Override
//				public void run() {
//					while(true) {
//						long threadId = Thread.currentThread().getId();
//						long id = nextId("t1");
//						System.out.println("线程["+threadId+"],ID["+id+"]");
//					}
//				}
//			}).start();
//		}
//	}
//	
//	
//	
//	/**
//     * 生成分布式ID
//     * 符号位    时间戳[31位]  自增序号【32位】
//     * @param item
//     * @return
//     */
//    public long nextId(String item){
//   
//   
//        // 1.生成时间戳
//        LocalDateTime now = LocalDateTime.now();
//        // 格林威治时间差
//        long nowSecond = now.toEpochSecond(ZoneOffset.UTC);
//        // 我们需要获取的 时间戳 信息
//        long timestamp = nowSecond - BEGIN_TIMESTAMP;
//        // 2.生成序号 --》 从Redis中获取
//        // 当前当前的日期
//        String date = now.format(DateTimeFormatter.ofPattern("yyyy:MM:dd"));
//        // 获取对应的自增的序号
//        Long increment = redisTemplate.opsForValue().increment("id:" + item + ":" + date);
//        return timestamp << 32 | increment;
//    }
//
//
//
//
//	
//
//}
